import { http as request } from '@/main'

export default {
  // ----------- #用户服务 --------------------
  // 用户登录
  login(data) {
    return request.post('/api/v1/user/login', data);
  },
  // 游客静默登录
  guestLogin(data) {
    return request.post('/api/v1/user/guest/login', data, { showLoading: false });
  },
  // - 用户注册
  register(data) {
    return request.post('/api/v1/user/register', data);
  },
  //  - 用户登出
  logout(data) {
    return request.post('/api/v1/user/logout', data);
  },
  // - 用户查询
  userInfo(params) {
    return request.get('/api/v1/user/info', { params });
  },
  // - 获取google授权url
  googleAuthUrl(params) {
    return request.get('/api/v1/user/google/auth-url', { params });
  },
  // - 谷歌登录
  googleLogin(data) {
    return request.post('/api/v1/user/google/login', data);
  },
  // ----------- # OSS接口 OSS凭证获取等操 -------------
  // - OSS安全凭证获取
  ossCredentials(params) {
    return request.get('/api/v1/oss/credentials', { params });
  },
  //------------- # 创作任务接口 -------------------
  // - 任务列表分页
  taskPage(params) {
    return request.get('/api/v1/creation/task/page', { params });
  },
  // -创作任务提交
  taskSubmit(data) {
    return request.post('/api/v1/creation/task/submit', data);
  },
  // -重试任务
  taskRetry(data) {
    return request.post(`/api/v1/creation/task/retry?taskNo=${data.taskNo}`);
  },
  // -任务详情
  taskInfo(params) {
    return request.get('/api/v1/creation/task/info', { params, showLoading: false });
  },
  // - 任务结果拉取
  taskResultPull(data) {
    return request.post('/api/v1/creation/task/resultPull', data);
  },
  // ------------ # 创作类型接口 -------------------
  // - 创作类型列表
  typeList(params) {
    return request.get('/api/v1/creation/type/list', { params });
  },
  // ----------------- # 积分接口 -------------------
  // 积分记录分页查询
  pointsTransactionPage(params) {
    return request.get('/api/v1/points/transactionPage', { params });
  },
  // 查询用户积分余额
  pointsBalance(params) {
    return request.get('/api/v1/points/balance', { params });
  },
  // ----------------- # 订单接口 -------------------
  // - 创建订单
  orderCreate(data) {
    return request.post('/api/v1/order/create', data);
  },
  // - 订单详情
  orderDetail(params) {
    return request.get('/api/v1/order/detail', { params });
  },
  // - 订单倒计时
  orderCountdown(params) {

    return request.get('/api/v1/order/countdown', { params });
  },
  // ----------------- # stripe接口相关 -------------------
  // - 获取会话
  stripeSession(params) {
    return request.get('/api/stripe/session', { params });
  }
};
